/*
 * HackSQL
 * Copyright (C) 2008-2009
 *
 * Authors: Higor Eurípedes Pimentel Fernandes de Araújo
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * $Id: types.h 54 2009-06-06 16:49:42Z heuripedes $
 */

#ifndef __TYPES_H__
#define __TYPES_H__

#define HACKSQL_DEFAULT_SERVER "localhost"
#define HACKSQL_DEFAULT_PORT   "4225"

#define MAX_RECV_DATA  1024

typedef enum {
	HS_ERROR_UNKNOWN,
	HS_ERROR_UNKNOWNABLE,
	HS_ERROR_UNKNOWN_SCHEME,
	HS_ERROR_UNKNOWN_FIELD,
	HS_ERROR_UNKNOWN_COMMAND,
	HS_ERROR_UNKNOWN_FUNCTION,
	HS_ERROR_SQL_ERROR,
	HS_ERROR_CONFIG_ERROR,
	HS_ERROR_FILE_OPEN,
	HS_ERROR_FILE_READ,
	HS_ERROR_FILE_WRITE,
	HS_ERROR_FILE_NOTFOUND,
	HS_ERRORABLE_ERROR,
	HS_ERROR_SCHEME_ERROR,
	HS_ERROR_ALLOC_ERROR,

	HS_ERROR_CODE_COUNT
} hs_errno;


/*
 * A typical command handler function.
 */
typedef int (cmd_func) (int, char **, char *);

typedef struct {
	char *name;		/* the command name */
	cmd_func *func;	/* a function to call when the command is called */
	char *desc;		/* description */
} command;

typedef struct {
	int argc;
	char **argv;
	char *raw;
} command_data;


#endif				/* __TYPES_H__ */
